/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bungabungaball.emitter;

import org.newdawn.slick.Color;
import org.newdawn.slick.Image;
import org.newdawn.slick.particles.ParticleEmitter;
import org.newdawn.slick.particles.ParticleSystem;

/**
 * The BungaParticleSystem supports the creation of visual effects.
 * 
 * @author Ingo Klose, Stephan Meyer, Sebastian Lehmann
 * @version 1.0
 */
public class BungaParticleSystem extends ParticleSystem {

    /**
     * The rotation
     */
    private float rotation;

    /**
     * Constructor
     *
     * @param defaultSprite
     */
    public BungaParticleSystem(Image defaultSprite) {
        super(defaultSprite);
        rotation = 0;
    }

    /**
     * Constructor
     *
     * @param defaultSpriteRef
     */
    public BungaParticleSystem(String defaultSpriteRef) {
        super(defaultSpriteRef);
        rotation = 0;
    }

    /**
     * Constructor
     *
     * @param defaultSpriteRef
     * @param maxParticles
     */
    public BungaParticleSystem(String defaultSpriteRef, int maxParticles) {
        super(defaultSpriteRef, maxParticles);
        rotation = 0;
    }

    /**
     * Constructor
     *
     * @param defaultSpriteRef
     * @param maxParticles
     * @param mask
     */
    public BungaParticleSystem(String defaultSpriteRef, int maxParticles, Color mask) {
        super(defaultSpriteRef, maxParticles, mask);
        rotation = 0;
    }

    /**
     *Constructor
     *
     * @param defaultSprite
     * @param maxParticles
     */
    public BungaParticleSystem(Image defaultSprite, int maxParticles) {
        super(defaultSprite, maxParticles);
        rotation = 0;
    }

    /**
     * Set the rotation
     *
     * @param r
     */
    public void setRotation(float r) {
        rotation = r;
        for (int emitterIdx = 0; emitterIdx < emitters.size(); emitterIdx++) {
            BungaParticleEmitter emitter = (BungaParticleEmitter) emitters.get(emitterIdx);
            removeEmitter(emitter);
            if (emitter instanceof BungaParticleEmitter) {
                emitter.setRotation(rotation);
            }
            addEmitter(emitter);
        }
    }

    /**
     * Get the rotation
     *
     * @return Returns rotation
     */
    public float getRotation() {
        return rotation;
    }

    /**
     * Set the rotation 0
     *
     */
    @Override
    public void reset() {
        super.reset();
        rotation = 0;
    }

    /**
     * Render
     *
     */
    @Override
    public void render() {
        super.render();
    }
}
